package edu.uta.cfl.GUI;

import java.util.ArrayList;

import edu.uta.cfl.data.Component;
import edu.uta.cfl.data.IterationResult;
import edu.uta.cfl.data.SUT;

/**
 * This class file will update the Suspicious Component
 * information on the screen
 * @author jagan
 *
 */
public class LoadSuspiciousComponents {
	private IterationResult iteration;
	private SUT sut;
	private ArrayList<String> suspiciousComponents = new ArrayList<String>();

	public LoadSuspiciousComponents(IterationResult iteration, SUT sut) {
		super();
		this.iteration = iteration;
		this.sut = sut;

	}

	public ArrayList<String> getSuspiciousComponents()
	{
		String rowInformation;
		int rowIndex = 1;
		for(Component cmp : iteration.getSuspiciousComponents())
		{

			int i = sut.getParameters().indexOf(cmp.getParameter());
			rowInformation = rowIndex+","+cmp.getParameter().getName() + "," + sut.getParameters().get(i).getValues()
					.get(cmp.getValue()) +","+String.format("%f",cmp.getRankValue());
			

			suspiciousComponents.add(rowInformation);
			rowIndex++;
		}


		return suspiciousComponents;

	}



}
